<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    select{
      width: 200px;
      height: 200px;
      background-color: yellowgreen;
      font-size: 20px;
    }
    .btns{
      display: inline-block;
      width: 30px;
      position: relative;
      top: -30px;
    }
    button{
      width: 30px;
      height: 30px;
      margin-bottom: 10px;
    }
  </style>
</head>
<body>
  <h1>城市选择</h1>
  <select name="" id="l_select" multiple>
    <option value="">北京</option>
    <option value="">上海</option>
    <option value="">深圳</option>
    <option value="">广州</option>
    <option value="">西红柿</option>
  </select>
  <div class="btns">
    <button class="all_r">&gt;&gt;</button>
    <button class="all_l">&lt;&lt;</button>
    <button class="right">&gt;</button>
    <button class="left">&lt;</button>
  </div>
  <select name="" id="r_select" multiple></select>
  <script src="../jquery-1.12.4.min.js"></script>
  <script>
    // 1 点击向右全部移动的按钮 左侧内容全部移动到右侧
    $('.all_r').click(function(){
      $('#l_select>option').appendTo('#r_select');
    });
    //2 点击向左全部移动的按钮 右侧内容全部移动到左侧(要求使用append()做练习)
    $('.all_l').click(function(){
      $('#l_select').append($('#r_select>option'));
    });
    //3 点击向右按钮 左侧选中哪个就将选中的移动到右侧
    $('.right').click(function(){
      $('#l_select>option:selected').appendTo('#r_select');
    });
    //4 点击向左按钮 右侧选中哪个就将相中的移动到左侧(要求使用append()做练习)
    $('.left').click(function(){
      $('#l_select').append($('#r_select>option:selected'));
    })
  </script>
</body>
</html>